import request from '@/axios'
import { DepartmentListResponse, DepartmentUserParams, DepartmentUserResponse } from './types'

export const getDepartmentApi = () => {
  return request.get<DepartmentListResponse>({ url: '/api/Department/getDepartments' })
}

export const getUserListApi = (data: any) => {
  return request.post({ url: '/api/User/GetUsers', data })
}

export const GetUserInfoApi = () => {
  return request.get({ url: '/api/User/GetUserInfo' })
}
export const addUserApi = (data: any) => {
  return request.post({ url: '/api/User/AddUser', data })
}
export const UpdateUserApi = (data: any) => {
  return request.post({ url: '/api/User/UpdateUser', data })
}

export const deleteUserByIdApi = (ids: string[] | number[]) => {
  return request.post({ url: '/api/User/DeleteUser', data: ids }) //: { ids }
}

export const saveDepartmentApi = (data: any) => {
  return request.post({ url: '/api/Department/AddDepartment', data })
}

export const deleteDepartmentApi = (ids: string[] | number[]) => {
  return request.post({ url: '/api/Department/DeleteDepartments', data: ids }) //: { ids }
}

export const getDepartmentTableApi = (data: any) => {
  return request.post({ url: '/api/Department/getDepartments', data })
}
export const getTreeDepartmentsApi = (data: any) => {
  return request.post({ url: '/api/Department/GetTreeDepartments', data })
}
export const UpdateDepartmentApi = (data: any) => {
  return request.post({ url: '/api/Department/UpdateDepartment', data })
}
export const downloadDepartmentTemplateApi = () => {
  return request.post({ url: '/api/Department/DownloadDepartmentTemplate', responseType: 'blob' })
}
export const exportDepartmentsApi = (data) => {
  return request.post({ url: '/api/Department/ExportDepartments', data })
}

export const downloadUserTemplateApi = () => {
  return request.post({ url: '/api/User/DownloadUserTemplate', responseType: 'blob' })
}
export const searchPreviewVideosApi = (data: any) => {
  return request.post({ url: '/api/FileBrowse/SearchPreviewVideos', data })
}
export const SearchPreviewVideoApi = (data: any) => {
  return request.post({ url: '/api/FileBrowse/SearchPreviewVideo', data })
}
